package com.maple.utils.util

import android.graphics.Bitmap
import android.graphics.BitmapFactory
import android.text.TextUtils
import android.util.Base64


class ImageUtils {

    companion object {

        fun base64ToBitmap(base64: String?): Bitmap? {
            if(TextUtils.isEmpty(base64)) {
                return null
            }
            val base64Str = base64?.replace("data:image/jpeg;base64,","")
            val decodedString = Base64.decode(base64Str,Base64.DEFAULT)
            val decodedByte = BitmapFactory.decodeByteArray(decodedString,0,decodedString.size)
            return decodedByte
        }
    }
}